package com.example.shoppingmall.dao;

import com.example.shoppingmall.pojo.Commodity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CommodityMapper {

    //全部商品数量
    public int countAll();

    //上架商品数量
    public int countUp();

    //下架商品数量
    public int countDown();

    //当库存少于十时的商品数量
    public int countRepertory();

    /**
     * 查询
     * @param name
     * @param status
     * @param repertory
     * @param no
     * @return
     */
    public List<Commodity>commodityList(@Param("name") String name, @Param("status") int status, @Param("repertory") int repertory,
                                        @Param("no") int no);

    /**
     * 列表总数
     * @param name
     * @param status
     * @param repertory
     * @return
     */
    public int countList(@Param("name") String name, @Param("status") int status, @Param("repertory") int repertory);

    /**
     * 删除商品
     * @param id
     * @return
     */
    public int delete(@Param("id") int id);

    public int add(Commodity commodity);

    public int chackName(@Param("name") String name);

    public Commodity xiangQing(@Param("id") int id);

    public int update(Commodity commodity);

    public int update1(Commodity commodity);

    public int updateUp(@Param("id") int id);

    public int updateDown(@Param("id") int id);

    public List<Commodity>list();

    public int addAll(@Param("commodities") List<Commodity> commodities);
}
